import requests


class TPshop_Login_Api:
    @classmethod
    def get_verify(self, sesssion):
        sesssion.get(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify")

    @classmethod
    def login(self, sesssion, login_data):
        res = sesssion.post(
            url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login",
            data=login_data)

        return res


if __name__ == '__main__':
    session=requests.Session()
    TPshop_Login_Api.get_verify(session)
    login_data={"username":"13800000002","password":"123456","verify_code":"8888"}
    res=TPshop_Login_Api.login(session,login_data)
    print(res.json())